
package com.yimixian.app.rest;

import com.yimixian.app.model.PayWithQQWalletResponse;
import com.yimixian.app.rest.api.AddressAPI;
import com.yimixian.app.rest.api.CartUpdateAPI;
import com.yimixian.app.rest.api.CategoryAPI;
import com.yimixian.app.rest.api.CategoryGoodsAPI;
import com.yimixian.app.rest.api.ClearRedPointAPI;
import com.yimixian.app.rest.api.CommentGetAPI;
import com.yimixian.app.rest.api.CommentPublishAPI;
import com.yimixian.app.rest.api.CommentReportAPI;
import com.yimixian.app.rest.api.CouDanKeyAPI;
import com.yimixian.app.rest.api.GetRedPointAPI;
import com.yimixian.app.rest.api.GoodDetailAPI;
import com.yimixian.app.rest.api.HomeDataAPI;
import com.yimixian.app.rest.api.HotTipsAPI;
import com.yimixian.app.rest.api.HuanGouKeyAPI;
import com.yimixian.app.rest.api.OrdersDetailAPI;
import com.yimixian.app.rest.api.OrdersListAPI;
import com.yimixian.app.rest.api.QuitLoginAPI;
import com.yimixian.app.rest.api.SearchKeyAPI;
import com.yimixian.app.rest.api.SessionDataAPI;
import com.yimixian.app.rest.response.AppConfigResponse;
import com.yimixian.app.rest.response.AsyncCreateOrderResponse;
import com.yimixian.app.rest.response.BaseResponse;
import com.yimixian.app.rest.response.CheckUserResponse;
import com.yimixian.app.rest.response.CreateAddressResponse;
import com.yimixian.app.rest.response.CreateOrderResponse;
import com.yimixian.app.rest.response.GetAdvertInfoResponse;
import com.yimixian.app.rest.response.GetStoreByLocationResponse;
import com.yimixian.app.rest.response.GetStoreResponse;
import com.yimixian.app.rest.response.PayWithAlipayResponse;
import com.yimixian.app.rest.response.PayWithWechatResponse;
import com.yimixian.app.rest.response.PullMessageResponse;
import com.yimixian.app.rest.response.ShowAddressesResponse;
import com.yimixian.app.rest.response.ShowCurrentUserResponse;
import com.yimixian.app.rest.response.StoresResponse;
import com.yimixian.app.rest.response.UpdateUserInfoResponse;
import com.yimixian.app.rest.response.ValidateOrderResponse;

import retrofit.Callback;
import retrofit.client.Response;
import retrofit.http.Field;
import retrofit.http.FormUrlEncoded;
import retrofit.http.GET;
import retrofit.http.POST;
import retrofit.http.Path;
import retrofit.http.Query;

public interface YmxRestService {

    @GET("/v5/app_config/android")
    AppConfigResponse getAppConfig(
            @Query("token") String token);

    @FormUrlEncoded
    @POST("/v3/feedbacks/create")
    BaseResponse createFeedbacks(
            @Field("token") String token,
            @Field("content") String content,
            @Field("debug_log") String debugLog);

    @GET("/v3/stores/get_by_location")
    GetStoreByLocationResponse getStoreByLocation(
            @Query("address_id") String addressId,
            @Query("poi_id") String poiId,
            @Query("longitude") String longitude,
            @Query("latitude") String latitude,
            @Query("coord_system") String coordSystem,
            @Query("token") String token);

    // @GET("/v3/users/current/show")
    // ShowCurrentUserResponse getCurrentUser(
    // @Query("token") String token);
    @GET("/v4/users/current/show")
    ShowCurrentUserResponse getCurrentUser(
            @Query("token") String token);

    /**
     * 修改用户信息
     */
    @FormUrlEncoded
    @POST("/v4/current/update_customer_data")
    UpdateUserInfoResponse updateUserInfo(
            @Field("token") String token,
            @Field("nick_name") String nick_name,
            @Field("sex") int sex,
            @Field("age") int age,
            @Field("career") String career);

    /**
     * 获取广告页面图片URL
     */
    @GET("/app_guide")
    GetAdvertInfoResponse getAdInfo(
            @Query("region") String region,
            @Query("channel") String channel,
            @Query("token") String token);

    /**
     * 获取物品详细信息
     */
    @GET(GoodDetailAPI.GOOD_DETAIL)
    void getGoodDetailInfo(
            @Path("id") String id,
            Callback<Response> cb);

    /**
     * 获取物品详细信息
     */
    @GET(GoodDetailAPI.GOOD_DETAIL)
    void getGoodDetailInfo(
            @Path("id") String id,
            @Query("store_id") int storeId,
            Callback<Response> cb);

    /**
     * 获取物品详细信息
     */
    @GET(GoodDetailAPI.GOOD_DETAIL)
    void getGoodDetailInfo(
            @Path("id") String id,
            @Query("token") String token,
            Callback<Response> cb);

    /**
     * 获取物品详细信息
     */
    @GET(GoodDetailAPI.GOOD_DETAIL)
    void getGoodDetailInfo(
            @Path("id") String id,
            @Query("store_id") int storeId,
            @Query("token") String token,
            Callback<Response> cb);

    /**
     * 获取 + / - 时商品更改信息
     */
    @FormUrlEncoded
    @POST(CartUpdateAPI.CART_UPDATE)
    void getCartUpdate(
            @Field("token") String token,
            @Field("good_id") int goodId,
            @Field("trend") int trend, // 操作方向,1表示增加一个,0表示减少一个
            @Field("address_id") int addressId,
            @Field("store_id") int storeId,
            @Field("shopping_cart") int shoppingCart,//	1：购物车内点击添加商品  0：非购物车内点击添加商品
            Callback<Response> cb);

    /**
     * 获取购物车中所有信息
     */
    @FormUrlEncoded
    @POST(CartUpdateAPI.CART_GET)
    void getCartInfo(
            @Field("token") String token,
            @Field("address_id") int addressId,
            @Field("store_id") int storeId,
            Callback<Response> cb);

    /**
     * 删除购物车中商品
     */
    @FormUrlEncoded
    @POST(CartUpdateAPI.CART_REMOVE)
    void removeCartItem(
            @Field("token") String token,
            @Field("address_id") int addressId,
            @Field("store_id") int storeId,
            @Field("good_id") int goodId,
            Callback<Response> cb);

    /**
     * 举报评论
     */
    @FormUrlEncoded
    @POST(CommentReportAPI.COMMENT_REPORT)
    void commentReport(
            @Field("token") String token,
            @Field("comment_id") String commentId,
            Callback<Response> cb);

    /**
     * 发表评论
     */
    @FormUrlEncoded
    @POST(CommentPublishAPI.COMMENT_PUBLISH)
    void commentPublish(
            @Field("token") String token,
            @Field("good_id") int goodId,
            @Field("content") String content,
            @Field("taste") int taste,
            @Field("freshness") int freshness,
            Callback<Response> cb);

    /**
     * 获取评论列表
     */
    @GET(CommentGetAPI.COMMENT_GET)
    void commentGet(
            @Query("token") String token,
            @Path("good_id") int goodId,
            @Query("offset") String offset,
            @Query("size") int size,
            Callback<Response> cb);

    /**
     * 获取评论列表
     */
    @GET(CommentGetAPI.COMMENT_GET)
    void commentGet(
            @Path("good_id") int goodId,
            @Query("offset") String offset,
            @Query("size") int size,
            Callback<Response> cb);

  /**
   * 获取热门搜索词
   */
  @GET(HotTipsAPI.GET_HOT_TIPS)
  void getHotTips(
      @Query("store_id") int storeId,
      @Query("token") String token,
      Callback<Response> cb);

  /**
   * 关键字搜索
   */
  @GET(SearchKeyAPI.SEARCH_KEY)
  void getSearchKeyResult(
      @Query("store_id") int storeId,
      @Query("token") String token,
      @Query("key_word") String keyWord,
      @Query("page") int page,
      Callback<Response> cb);

    /**
     * 获取分类页数据
     */
    @GET(CategoryAPI.CATEGORY_GET)
    void categoryGet(
            @Query("address_id") String addressId,
            @Query("token") String token,
            Callback<Response> cb);

    /**
     * 获取分类页数据
     */
    @GET(CategoryAPI.CATEGORY_GET)
    void categoryGet(
            @Query("poi_id") String poiId,
            @Query("longitude") String longitude,
            @Query("latitude") String latitude,
            @Query("coord_system") String coordSystem,
            @Query("token") String token,
            Callback<Response> cb);
    /**
     * 获取分类页某个分类下面数据
     */
    @GET(CategoryGoodsAPI.CATEGORY_GOODS_GET)
    void categoryGoodsGet(
            @Path("category_id") int categoryId,
            @Query("store_id") int goodId,
            @Query("token") String token,
            Callback<Response> cb);

    @GET("/v3/users/current/addresses/show")
    ShowAddressesResponse getAddresses(
            @Query("token") String token,
            @Query("coord_system") String coordSystem);

    @GET(AddressAPI.ADDRESSURL)
    void getAddress(
            @Query("token") String token,
            @Query("store_id") int storeId,
            @Query("coord_system") String coordSystem,
            Callback<Response> cb);

    @GET("/v4/orders/get_by_task")
    CreateOrderResponse getOrders(
            @Query("token") String token,
            @Query("task_id") String taskId);

    @FormUrlEncoded
    @POST("/v3/users/current/addresses/create")
    CreateAddressResponse createAddress(
            @Field("token") String token,
            @Field("name") String name,
            @Field("gender") String gender,
            @Field("tel") String tel,
            @Field("province") String province,
            @Field("province_key") String province_key,
            @Field("city") String city,
            @Field("city_key") String city_key,
            @Field("district") String district,
            @Field("district_key") String district_key,
            @Field("poi_id") String poiId,
            @Field("poi_name") String poiName,
            @Field("poi_address") String poiAddress,
            @Field("room_no") String roomNo,
            @Field("tag") String tag,
            @Field("longitude") String longitude,
            @Field("latitude") String latitude,
            @Field("coord_system") String coordSystem);

    @FormUrlEncoded
    @POST("/v3/users/current/addresses/{address_id}/update")
    BaseResponse updateAddress(
            @Path("address_id") String addressId,
            @Field("token") String token,
            @Field("name") String name,
            @Field("gender") String gender,
            @Field("tel") String tel,
            @Field("province") String province,
            @Field("province_key") String province_key,
            @Field("city") String city,
            @Field("city_key") String city_key,
            @Field("district") String district,
            @Field("district_key") String district_key,
            @Field("poi_id") String poiId,
            @Field("poi_name") String poiName,
            @Field("poi_address") String poiAddress,
            @Field("room_no") String roomNo,
            @Field("tag") String tag,
            @Field("longitude") String longitude,
            @Field("latitude") String latitude,
            @Field("coord_system") String coordSystem);

    @FormUrlEncoded
    @POST("/v3/users/current/addresses/{address_id}/delete")
    BaseResponse deleteAddress(
            @Path("address_id") String addressId,
            @Field("token") String token);

    @FormUrlEncoded
    @POST("/v4/payments/{payment_id}/declare_paid")
    BaseResponse paySuccess(
            @Path("payment_id") String paymentId,
            @Field("payment_method") String paymentMethod,
            @Query("token") String token);

    @FormUrlEncoded
    @POST("/v3/verify_code/get")
    BaseResponse getVerifyCode(
            @Field("tel") String phoneNumber,
            @Field("token") String token);

    @FormUrlEncoded
    @POST("/v3/verify_code/check")
    CheckUserResponse checkUser(
            @Field("refer_from") String referFrom,
            @Field("tel") String phoneNumber,
            @Field("verify_code") String verifyCode,
            @Field("token") String token);

    @FormUrlEncoded
    @POST("/v5/cart/verify")
    ValidateOrderResponse validateOrderByAddressId(
            @Field("token") String token,
            @Field("group_id") long groupId,
            @Field("address_id") int addressId);

    @FormUrlEncoded
    @POST("/v5/cart/verify")
    ValidateOrderResponse validateOrderByAddressId(
            @Field("token") String token,
            @Field("group_id") long groupId,
            @Field("address_id") int addressId,
            @Field("delivery_option_id") int deliveryOptionId,
            @Field("bonus_id") int bonusId);

    @FormUrlEncoded
    @POST("/v5/cart/verify")
    ValidateOrderResponse validateOrderByStoreId(
            @Field("token") String token,
            @Field("group_id") long groupId,
            @Field("store_id") int storeId);

    @FormUrlEncoded
    @POST("/v5/cart/verify")
    ValidateOrderResponse validateOrderByStoreId(
            @Field("token") String token,
            @Field("group_id") long groupId,
            @Field("store_id") int storeId,
            @Field("delivery_option_id") int deliveryOptionId,
            @Field("bonus_id") int bonusId);

    @FormUrlEncoded
    @POST("/v4/orders/create_async")
    AsyncCreateOrderResponse createAsyncOrder(
            @Field("token") String token,
            @Field("order_string") String createAsync,
            @Field("refer_from") String referFrom,
            @Field("longitude") String longitude,
            @Field("latitude") String latitude,
            @Field("coord_system") String refercoordSystem);

    @GET(OrdersListAPI.ORDER_LIST)
    void getOrdersList(
            @Query("token") String token,
            @Query("last_id") int last_id,
            @Query("pagesize") int pagesize, Callback<Response> cb);

    @GET(OrdersListAPI.ORDER_LIST)
    void getOrdersList(
            @Query("token") String token,
            @Query("pagesize") int pagesize, Callback<Response> cb);
  
    @GET(OrdersDetailAPI.ORDER_INFO)
    void getOrdersInfo(
            @Query("token") String token,
            @Query("order_id") int orderId, Callback<Response> cb);

    // 获取红点
    @GET(GetRedPointAPI.GETREDURL)
    void getRedPoint(
            @Query("token") String token, Callback<Response> cb);

    // 清除红点
    @FormUrlEncoded
    @POST(ClearRedPointAPI.CLEARURL)
    void clearRedPoint(
            @Field("token") String token,
            @Field("key") String key, Callback<Response> cb);

    // 退出登录
    @FormUrlEncoded
    @POST(QuitLoginAPI.QUITURL)
    void quitLogin(
            @Field("token") String token, Callback<Response> cb);

    @GET("/v3/pull_message")
    PullMessageResponse getPullMessageByToken(
            @Query("token") String token);

    @GET("/v3/pull_message")
    PullMessageResponse getPullMessageByLocation(
            @Query("longitude") String longitude,
            @Query("latitude") String latitude,
            @Query("coord_system") String coord_system,
            @Query("token") String token);

    @FormUrlEncoded
    @POST("/v3/orders/create")
    CreateOrderResponse createOrderByAddressId(
            @Field("refer_from") String referFrom,
            @Field("token") String token,
            @Field("address_id") int addressId,
            @Field("delivery_mode_id") int deliveryModeId,
            @Field("goods") String goodsJsonString,
            @Field("longitude") String longitude,
            @Field("latitude") String latitude);

    @FormUrlEncoded
    @POST("/v3/orders/create")
    CreateOrderResponse createOrderByStoreId(
            @Field("refer_from") String referFrom,
            @Field("token") String token,
            @Field("store_id") int storeId,
            @Field("delivery_mode_id") int deliveryModeId,
            @Field("goods") String goodsJsonString,
            @Field("longitude") String longitude,
            @Field("latitude") String latitude);

    @FormUrlEncoded
    @POST("/v3/orders/create_async")
    AsyncCreateOrderResponse asyncCreateOrderByAddressId(
            @Field("refer_from") String referFrom,
            @Field("token") String token,
            @Field("address_id") int addressId,
            @Field("delivery_mode_id") int deliveryModeId,
            @Field("goods") String goodsJsonString,
            @Field("longitude") String longitude,
            @Field("latitude") String latitude);

    @FormUrlEncoded
    @POST("/v3/orders/create_async")
    AsyncCreateOrderResponse asyncCreateOrderByStoreId(
            @Field("refer_from") String referFrom,
            @Field("token") String token,
            @Field("store_id") int storeId,
            @Field("delivery_mode_id") int deliveryModeId,
            @Field("goods") String goodsJsonString,
            @Field("longitude") String longitude,
            @Field("latitude") String latitude);

    @GET("/v3/orders/get_by_task")
    CreateOrderResponse getOrderByTaskId(
            @Path("task_id") String taskId);

    @GET("/v4/payments/{payment_id}/pay_with_alipay")
    PayWithAlipayResponse payWithAlipay(
            @Path("payment_id") String paymentId,
            @Query("token") String token);

    @GET("/v4/payments/{payment_id}/pay_with_wechat")
    PayWithWechatResponse payWithWechat(
            @Path("payment_id") String paymentId,
            @Query("token") String token);

    @GET("/v4/payments/{payment_id}/pay_with_qqwallet")
    PayWithQQWalletResponse payWithQQWallet(
            @Path("payment_id") String paymentId,
            @Query("token") String token);

    @FormUrlEncoded
    @POST("/v4/payments/{payment_id}/pay_with_balance")
    BaseResponse payWithBalance(
            @Path("payment_id") String paymentId,
            @Field("token") String token);

    @FormUrlEncoded
    @POST("/v3/users/current/register_push")
    BaseResponse registerPushToken(
            @Field("token") String token,
            @Field("push_token_provider") String provider,
            @Field("push_token") String pushToken);

    @FormUrlEncoded
    @POST("/v3/users/current/logout")
    BaseResponse logoutUser(
            @Field("token") String token);

    @GET("/v3/stores/show")
    StoresResponse getStores(
            @Query("delivery_type") String deliveryType,
            @Query("region_id") String regionId,
            @Query("longitude") String longitude,
            @Query("latitude") String latitude,
            @Query("coord_system") String coordSystem,
            @Query("token") String token);

    @GET("/v3/stores/{store_id}/show")
    GetStoreResponse getStoreByStoreId(
            @Path("store_id") String storeId,
            @Query("trim_sections") int trimSections,
            @Query("longitude") String longitude,
            @Query("latitude") String latitude,
            @Query("coord_system") String coordSystem,
            @Query("token") String token);

    /**
     * 根据经纬度获取首页店铺信息
     * 
     * @param longitude 经度
     * @param latitude 纬度
     * @param poiId
     * @param coordSystem
     * @param cb
     */
    @GET(HomeDataAPI.HOMEDATAURL)
    void getHomeDataByLocated(
            @Query("token") String token,
            @Query("longitude") String longitude,
            @Query("latitude") String latitude,
            @Query("poi_id") String poiId,
            @Query("coord_system") String coordSystem,
            Callback<Response> cb);

    /**
     * 根据id获取首页店铺信息
     * 
     * @param addressId
     * @param cb
     */
    @GET(HomeDataAPI.HOMEDATAURL)
    void getHomeDataBySaved(
            @Query("token") String token,
            @Query("address_id") String addressId,
            Callback<Response> cb);

    /**
     * 根据store_id获取专场列表信息
     * 
     * @param storeId
     * @param specialId
     * @param cb
     */
    @GET(SessionDataAPI.SESSIONDATAURL)
    void getSessionData(
            @Query("token") String token,
            @Query("store_id") String storeId,
            @Query("special_id") String specialId,
            Callback<Response> cb);

    /**
     * 根据store_id获取专场列表信息
     * 
     * @param storeId
     * @param cb
     */
    @GET(SessionDataAPI.SESSIONDATAURL)
    void getSessionData(
            @Query("token") String token,
            @Query("store_id") String storeId,
            Callback<Response> cb);

    /**
     * 同步本地购物车数据到服务器
     */
    @FormUrlEncoded
    @POST(CartUpdateAPI.CART_SYNC_NOT_LOGIN_API)
    void getCartSyncUnLogin(
        @Field("goods_j") String goods_j,
        @Field("token") String token,
        @Field("store_id") int storeId,
        Callback<Response> cb);

    /**
     * 凑单
     */
    @GET(CouDanKeyAPI.COU_DAN_KEY)
    void getCouDanData(
            @Query("longitude") String longitude,
            @Query("latitude") String latitude,
            @Query("store_id") String store_id,
            @Query("token") String token,
            @Query("pici") String pici,
            @Query("group_id") String group_id,
            Callback<Response> cb);

    /**
     * 换购
     */
    @GET(HuanGouKeyAPI.HUAN_GOU_KEY)
    void getHuanGouData(
            @Query("longitude") String longitude,
            @Query("latitude") String latitude,
            @Query("store_id") String store_id,
            @Query("token") String token,
            @Query("group_id") String group_id,
            Callback<Response> cb);
}
